var express = require('express');
var router = express.Router();
//表现层，只负责传递东西到逻辑层，和接收逻辑层的结果。
let { reg, getUser, auditPass,login,removeUser,UpdateUser,getApplyUser,updateUserStatus } = require('../server/adminsServer.js')

//登录
router.post('/login', async function (req, res, next) {
	res.send(await login(req.body))
})

//注册
router.post('/reg', async function (req, res, next) {
	res.send(await reg(req.body))
})
//获取申请用户
router.post('/getApplyUser', async function (req, res, next) {
	res.send(await getApplyUser(req.body))
})

//获取用户（分页）
router.post('/getUser', async function (req, res, next) {
	res.send(await getUser(req.body))
})
//修改用户信息
router.post('/UpdateUser', async function (req, res, next) {
	res.send(await UpdateUser(req.body))
})

//审核修改用户
router.post('/auditPass', async function (req, res, next) {
	res.send(await auditPass(req.body))
})
//删除用户
router.post('/removeUser', async function (req, res, next) {
	res.send(await removeUser(req.body))
})
//处理管理员申请，修改 userStatus 的状态值 
router.post('/updateUserStatus', async (req, res) => {
	res.send(await updateUserStatus(req.body));
});
module.exports = router;
